{extend name="default/template/base_index" /}


{block name="area_header"}

    <link rel="stylesheet" href="__CDN__/jquery-datetimepicker/jquery.datetimepicker.css">
    <!--<link rel="stylesheet" href="//cdn.bootcss.com/jquery-datetimepicker/2.5.1/jquery.datetimepicker.min.css">-->

    <script type="text/javascript" src="__CDN__/jquery-validation/1.13.1/jquery.validate.min.js"></script>
    <script type="text/javascript" src="__CDN__/jquery-datetimepicker/jquery.datetimepicker.js"></script>
    <!--<script type="text/javascript" src="//cdn.bootcss.com/jquery-datetimepicker/2.5.1/jquery.datetimepicker.min.js"></script>-->
    <script type="text/javascript" src="__CDN__/jquery-validation/1.13.1/localization/messages_zh.min.js"></script>

    <style type="text/css">
        .pt8{
            width:2rem !important;
            padding-top: 8px;
        }
        input.error {
            border: 1px solid red;
        }
        label.checked {
            padding-left: 25px;
        }
        label.error {
            padding-left: 25px;
            padding-bottom: 2px;
            font-weight: bold;
            color: #EA5200;
        }
    </style>

{/block}

{block name="area_body"}
{include file="default/Widget/topbar" /}
    <div class="admin-main container-fluid">
        {include file="default/Widget/left" /}
        <div class="admin-main-content">
            {include file="default/Widget/breadcrumb" /}
            <!-- 带验证 form -->
            <form id="validateForm" class="form-horizontal well validateForm">
                <fieldset>
                    <legend>编辑[{$entity['country_name']}]</legend>
                    <div class="form-group">
                        <label for="country" class="col-md-2 col-lg-2 control-label">名称</label>
                        <div class="col-md-10 col-lg-10">
                            <input type="text" class="required form-control input-normal" name="country_name" id="country" placeholder="{:L('PLACEHOLDER_TITLE')}" value="{$entity['country_name']}">
                            <div class="help-block">(名称)</div>
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="country_code" class="col-md-2 col-lg-2 control-label">国家编号</label>
                        <div class="col-md-10 col-lg-10">
                            <input type="text" class="required form-control input-normal" name="country_code" id="country_code" placeholder="国家编号" value="{$entity.country_code}">
                            <div class="help-block">(国家编号)</div>
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="country_code" class="col-md-2 col-lg-2 control-label">国家电话区号</label>
                        <div class="col-md-10 col-lg-10">
                            <input type="text" class="required form-control input-normal" name="country_tel_prefix" id="country_tel_prefix" placeholder="国家电话区号" value="{$entity.country_tel_prefix}">
                            <div class="help-block">(国家电话区号)</div>
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="py" class="col-md-2 col-lg-2 control-label">国家首字母拼音</label>
                        <div class="col-md-10 col-lg-10">
                            <input type="text" class="required form-control input-normal" name="py" id="py" placeholder="国家首字母拼音" value="{$entity.py}">
                            <div class="help-block">(国家首字母拼音)</div>
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="btns" class="col-md-2 col-lg-2 control-label">&nbsp;</label>
                        <div class="col-lg-10 col-md-10">
                            <a target-form="validateForm" class="ajax-post btn btn-primary" href="{:U('Country/edit',array('id'=>$entity['id']))}" autofocus="autofocus"  data-loading-text="{:L('BTN_SAVE')}..." ><i class="fa fa-save"></i> {:L('BTN_SAVE')}</a>
                            <a class="btn btn-default" href="{:U(CONTROLLER_NAME.'/index')}"><i class="fa fa-times-circle"></i> {:L('BTN_CANCEL')}</a>
                        </div>
                    </div>
                </fieldset>
            </form>
            <!-- form -->
        </div>
        <!-- END admin-main-content -->
    </div>
    <!-- END admin-main-->
{/block}

{block name="area_footer"}
    <script type="text/javascript">
        $(function() {

            //是否中文名字
//            $.validator.addMethod("isCnName", function(value, element) {
//                var tel = /[a-z0-9.*?,(!)&amp;%$^……！·￥——（）　#@]/g;
//                return this.optional(element) || !(tel.test(value));
//            }, "请填写正确的姓名");
//            // 联系电话(手机/电话皆可)验证
//            $.validator.addMethod("isPhone", function(value, element) {
//                var length = value.length;
//                var mobile = /^(((13[0-9]{1})|(15[0-9]{1}))+\d{8})$/;
//                var tel = /^\d{3,4}-?\d{7,9}$/;
//                return this.optional(element) || (tel.test(value) || mobile.test(value));
//            }, "请正确填写您的联系电话");
//            // 身份证号码验证
//            $.validator.addMethod("isIdCardNo", function(value, element) {
//                return this.optional(element) || IdCardValidate(value);
//            }, "请正确输入您的身份证号码");
            $("#validateForm").validate({
            //     errorPlacement: function(error, element) {
            //         $(".checked", element.parent()).remove();
            //         error.appendTo(element.parent());
            //     }
            //     ,success: function(label) {
            //         label.removeClass("error").addClass("checked").text("验证成功!");
            //     }
                //,rules: {
                //     name: {
                //         required: true,
                //         remote: {
                //             url: "{:U('Game/check_name')}"
                //         }
                //     }
                // }
            }) //end validate
        }); //end ready
    </script>
{/block}